<template>
  <page-container title="请假条">
    <el-form :model="form" label-width="auto" style="max-width: 600px">
      <el-form-item label="请假人">
        <el-input v-model="form.name" />
      </el-form-item>
      <el-form-item label="目的地">
        <el-select v-model="form.place" placeholder="请选择你要去的目的地">
          <el-option label="江西" value="jiangxi" />
          <el-option label="北京" value="beijing" />
          <el-option label="上海" value="shanghai" />
          <el-option label="广东" value="guangdong" />
        </el-select>
      </el-form-item>
      <el-form-item label="请假时间">
        <el-col :span="11">
          <el-date-picker
            v-model="form.date1"
            type="date"
            placeholder="离校时间"
            style="width: 100%"
          />
        </el-col>
        <el-col :span="2" class="text-center">
          <span class="text-gray-500">-</span>
        </el-col>
        <el-col :span="11">
          <el-date-picker v-model="form.date2" placeholder="到校时间" style="width: 100%" />
        </el-col>
      </el-form-item>
      <el-form-item label="家长知悉">
        <el-switch v-model="form.konw" />
      </el-form-item>
      <el-form-item label="请假原因">
        <el-checkbox-group v-model="form.thing">
          <el-checkbox value="Online activities" name="type"> 生病 </el-checkbox>
          <el-checkbox value="Promotion activities" name="type"> 外出游玩 </el-checkbox>
          <el-checkbox value="Offline activities" name="type"> 家中有事 </el-checkbox>
          <el-checkbox value="Simple brand exposure" name="type">
            其他（请在下方写具体原因）
          </el-checkbox>
        </el-checkbox-group>
      </el-form-item>
      <el-form-item label="紧急情况联系方式">
        <el-input v-model="form.number" />
      </el-form-item>
      <el-form-item label="请假原因">
        <el-input v-model="form.desc" type="textarea" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">提交</el-button>
        <el-button @click="Onreset">重置</el-button>
      </el-form-item>
    </el-form>
  </page-container>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import PageContainer from "@/components/PageContainer.vue";

// do not use same name with ref
const form = ref({
  name: "",
  place: "",
  date1: "",
  date2: "",
  konw: false,
  thing: [],
  number: "",
  desc: "",
});

const onSubmit = () => {
  alert("提交成功");
  form.value = {};
};

const Onreset = () => {
  form.value = {};
};
</script>

<style></style>
